<template>
    <div class="UnBillChecked">
        <cardComponent :pageTitle="`查询服务类-未出账单明细查询（ 账户类别： ${ITEMCM} ）`">
            <template slot="cardBody">
                <div
                    class="detaillist"
                    v-loading="isLoadingss"
                    element-loading-background="rgba(250, 250, 250, 0.7)"
                >
                    <el-form
                        ref="rowObjformRef"
                        label-width="105px"
                        size="small"
                        :inline="true"
                        label-position="right"
                        class="formData_form_inline"
                    >
                        <el-row>
                            <el-col :span="8">
                                <el-form-item label="账户类别:" class="text_fl">
                                    <el-select
                                        v-model="searchForm.accttype"
                                        placeholder="请选择账户类别"
                                        clearable
                                        @change="changeCardList"
                                    >
                                        <el-option
                                            v-for="item in AccountionTYPE_INFO"
                                            :label="item.label"
                                            :value="item.code"
                                            :key="item.label"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <!-- <el-form-item label="卡号:" class="text_fl">
                                    <el-select
                                        v-model="searchForm.cardno"
                                        placeholder="请选择卡号"
                                        disabled
                                    >
                                        <el-option
                                            v-for="item in cardList"
                                            :label="item.CARDNBR"
                                            :value="item.CARDNBR"
                                            :key="item.CARDNBR"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>-->
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <el-form-item label="消费总额: ">
                                    <el-input disabled :value="totalSumMap.totalPurchases"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item label="取现总额: ">
                                    <el-input disabled :value="totalSumMap.totalEnchashment"></el-input>
                                </el-form-item>
                            </el-col>
                            <!-- <el-col :span="8">
                                <el-form-item label="费用总额: ">
                                    <el-input disabled v-model="totalSumMap.totalfee"></el-input>
                                </el-form-item>
                            </el-col>-->
                            <el-col :span="8">
                                <el-form-item label="应收利息: ">
                                    <el-input disabled :value="totalSumMap.totalINTCHG"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <el-form-item label="还款总额: ">
                                    <el-input disabled v-model="totalSumMap.totalPayBack"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item label="退货总额: ">
                                    <el-input disabled v-model="totalSumMap.totalreturn"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8"></el-col>
                        </el-row>
                    </el-form>
                    <el-table
                        :data="tableData"
                        width="100%"
                        highlight-current-row
                        style="margin-bottom: 16px;"
                        border
                        stripe
                        class="heard-bg business_table"
                    >
                        <el-table-column label width="35">
                            <template slot-scope="scope">
                                <el-radio v-model="isChecked" :label="scope.row">{{""}}</el-radio>
                            </template>
                        </el-table-column>
                        <el-table-column label="交易日期时间" show-overflow-tooltip min-width="120">
                            <template slot-scope="scope">
                                <span>{{ scope.row.PURTIME | getFormatDate(scope.row.VALDATE+'', scope.row.PURDATE1+'') }}</span>
                            </template>
                        </el-table-column>

                        <el-table-column label="记账日" min-width="75">
                            <template slot-scope="scope">
                                <span>{{scope.row.PURDATE | formatDate}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="交易描述" show-overflow-tooltip min-width="200">
                            <template slot-scope="scope">
                                <span>{{scope.row.DESLINE1 || ""}} &nbsp; {{scope.row.DESLINE2 || ""}}</span>
                            </template>
                        </el-table-column>
                        <!-- <el-table-column label="交易类型" prop="TRANTYPE_1" min-width="150"></el-table-column>
                        <el-table-column label="商户类型代码" prop="MCC" min-width="75"></el-table-column>-->
                        <el-table-column label="交易金额" show-overflow-tooltip min-width="100">
                            <template slot-scope="scope">
                                <span>{{scope.row.AMOUNT |formatAmount(scope.row.AMTFLAG)}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="授权号码" show-overflow-tooltip min-width="100">
                            <template slot-scope="scope">
                                <span>{{scope.row.AUTHCODE }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="交易流水号" prop="TRANNO" min-width="60"></el-table-column>
                        <el-table-column label="卡号末四位" min-width="68">
                            <template slot-scope="scope">
                                <span>{{scope.row.CARDEND | formatCardend}}</span>
                            </template>
                        </el-table-column>
                    </el-table>
                    <!-- 话术 -->
                    <div class="hstable_wrap" v-if="speechList.length!=0">
                        <el-table
                            :data="speechList"
                            border
                            stripe
                            header-row-class-name="headerRow"
                            ref="showListTable"
                            class="heard-bg business_table hstable"
                            @selection-change="handleSelectionChange"
                        >
                            <el-table-column type="selection" label=" " min-width="55"></el-table-column>
                            <el-table-column label="业务话术">
                                <template slot-scope="scope">{{scope.row.content}}</template>
                            </el-table-column>
                        </el-table>
                    </div>

                    <div class="btn_box">
                        <!--<el-button type="primary" size="small" @click="Choice">争议账款工单</el-button>
                        <el-button type="primary" size="small" plain @click="ChoiceAuth">授权详细记录</el-button>
                        <el-button type="primary" size="small" @click="sendMsg">发送短信</el-button>
                        <el-button type="primary" size="small" plain @click="mpabletrans">灵活分期申请</el-button>-->
                        <el-button size="small" type="primary" @click="sendMsg">发送短信</el-button>
                        <el-button size="small" type="primary" @click="mpabletrans">消费分期申请</el-button>
                        <el-button
                            type="primary"
                            size="small"
                            @click="handleChangePage('pre')"
                            :disabled="currentPageIndex <= 0"
                        >上一页</el-button>
                        <el-button
                            type="primary"
                            size="small"
                            @click="handleChangePage('next')"
                            :disabled="nextButtonFlag"
                        >下一页</el-button>
                        <el-button
                            :disabled="lastButtonFlag"
                            type="primary"
                            size="small"
                            @click="handleLastPage()"
                        >尾页</el-button>
                        <span style="margin-left:20px;">{{PG}}</span>
                    </div>
                </div>
            </template>
        </cardComponent>
    </div>
</template>

<script>
// 积分汇总查询
import { mapState } from 'vuex';
import moment from 'moment';
import { getAccountTypeName, MobileNum, getBusinessMenuId } from '@/utils/Common';
import cardComponent from '@/components/cardComponent/cardComponent.vue';
import { isEmptyObject, ChangePage } from '@/utils/Object';
import { get_3xxx } from '@/apis/getAPIClass';
import { getToken, getTokenHsbankNo } from '@/utils/auth';

export default {
    name: 'unBillChecked',
    data() {
        return {
            ITEMCM: '',
            tableData: [],
            ACCOUNTTYPELIST: [], // 账户类型 下拉选择列表
            bnknbr: getTokenHsbankNo('HsbankNo'),
            isChecked: {},
            categoryMap: {},
            totalSumMap: {
                totalPurchases: 0,//消费总额
                totalEnchashment: 0,//取现总额
                totalCommission: 0,//取现手续费总额
                totalmppayfee: 0,//分期提前还款手续费
                resendstfee: 0,//帐单补寄费用
                changecardfee: 0,//补换卡费用
                totalfee: 0,// 费用总额=取现手续费+分期提前还款手续费（交易描述需确认）+账单补寄费+补换卡费
                totalPayBack: 0,//还款总额
                totalINTCHG: 0,//应收利息
                totalreturn: 0,//退货总额

            },
            pagingDataList: [], // 分期付款申请编号(只存每页最后一条记录)
            currentPageIndex: '', // 当前页最后一条记录的申请编号的索引
            nextButtonFlag: true, // ‘下一页’  按钮的显示控制阀
            PURDATE: '',
            VALDATE: '',
            PURTIME: '',
            TRANNO: '',
            searchForm: { // 搜索表单字段
                accttype: '',
                cardno: '',
            },
            cardList: [],
            RtnindFlag: '0',
            pageList: [],//翻页查询数据，保存每一页的最后一条数据
            RtnindFlagAll: '0',
            resultlist: [],//保存所有明细记录
            detailDataAll: [],//保存当前页记录
            totCnt: 0,//总条数
            totPgCnt: 0,//总页数
            PG: '',//页数信息
            lastButtonFlag: true,
            speechList: [],//话术列表
            selectedList: [],
            MenuId: '',
            isLoadingss: false,
        };
    },
    computed: mapState({
        cardInfo_3004: state => state.common.cardInfo_3004,
        cardList_3601: state => state.common.cardList_3601, // 卡列表数据
        defaultParams: state => state.common.defaultParams,
        defaultpinFlag: state => state.common.pinFlag,
        AccountionTYPE_INFO: state => state.common.AccountionTYPE_INFO, //账户类别列表
        multiAccounts: state => state.common.AccountionTYPE_INFO,
        isCurrentMenuInfo: state => state.menu.isCurrentMenuInfo,
        businessMenu: state => state.menu.businessMenu,
    }),
    async created() {


    },

    async mounted() {
        this.MenuId = this.$route.params.id || '';
        // 计算多账户总金额信息
        await this.init();
        //this.calTotalSum();
        // this.changeCardList(this.cardInfo_3004.CATEGORY + '');
        await this.getspeechList();
    },

    filters: {
        // 获取日期时间转换
        getFormatDate(time, date, date1) {
            let res = '';
            let str = '';
            let tmp = '';
            const timeStr = time.toString().trim();
            if (date !== 0) {
                tmp = `00000000${timeStr}`;
                tmp = tmp.substring(tmp.length - 8, tmp.length);
                str = tmp.substring(0, 2).concat(':').concat(tmp.substring(2, 4)).concat(':')
                    .concat(tmp.substring(4, 6));
            }
            let Str = '';
            if (date) {
                const dateStr = date.toString().trim();
                const month1 = Number(date1.substring(0, 2));
                const month2 = Number(dateStr.substring(4, 6));
                if (month1 - month2 === 11) {
                    const year = `${Number(dateStr.substring(0, 4)) - 1}`;
                    Str = year.concat('-').concat(date1.substring(0, 2)).concat('-').concat(date1.substring(2, 4));
                } else {
                    Str = dateStr.substring(0, 4).concat('-').concat(date1.substring(0, 2)).concat('-')
                        .concat(date1.substring(2, 4));
                }

                res = `${Str} ${str}`;
            }
            return res;
        },
        // 卡号末四位自动补0
        formatCardend(val) {
            return val.toString().padStart(4, '0');
        },
        // 日期格式转换
        formatDate(val) {
            const text = `${val}`;
            return moment(text).format('YYYY-MM-DD');
        },
        //格式化交易金额，加上交易金额符号，精确小数点后2位小数
        formatAmount(amt, flag) {
            if (flag === '-') {
                amt = parseFloat(-1.00 * amt).toFixed(2);
            } else {
                amt = parseFloat(1.00 * amt).toFixed(2);
            }
            return amt;
        },
    },
    methods: {
        async init() {
            console.log("默认账户类别：" + this.cardInfo_3004.CATEGORY);
            console.log("默认账户：" + this.cardInfo_3004.CARDNO + ",产品：" + this.cardInfo_3004.PRODUCT);
            this.searchForm.accttype = this.cardInfo_3004.CATEGORY + '';

            this.searchForm.cardno = this.cardInfo_3004.CARDNO;
            // 调用3001 查询未出账单头信息
            await this.getAccountSum();
            // 调用3011 查询未出账单交易明细
            await this.getData();
            // 获取账户类型
            this.ITEMCM = await getAccountTypeName(this.cardList_3601, this.cardInfo_3004, this) || this.cardInfo_3004.CATEGORY;
            // 获取账户类型下拉列表
            this.getAccountTypeData({ dictValue: 'CATE' }, 'ACCOUNTTYPELIST');

        },
        async changeCardList(val) {
            console.log("当前账户类型：" + val);
            let hasDefault = false; //是否包含默认卡
            this.cardList = [];
            this.cardList_3601.forEach((item) => {
                if (item.CATEGORY + '' === val) {
                    this.cardList.push(item);
                    if (item.CARDNBR === this.cardInfo_3004.CARDNO) {
                        hasDefault = true;
                    }
                }
            });
            console.log('是否 获取到卡号————————', this.$route.params.cardIds);
            //this.searchFormOne.CARDNO = this.$route.params.cardNo;
            if (this.$route.params.cardIds) {
                this.searchForm.cardno = this.$route.params.cardIds;
            } else {
                //包含默认卡，卡号显示默认卡，不包含，显示cardList里第一张卡号
                if (hasDefault) {
                    this.searchForm.cardno = this.cardInfo_3004.CARDNO;
                } else {
                    this.searchForm.cardno = this.cardList[0].CARDNBR;
                }
            }
            // 调用3001 查询未出账单头信息
            await this.getAccountSum();
            await this.getData();

            // 获取账户类型
            this.ITEMCM = await getAccountTypeName(this.cardList_3601, this.cardInfo_3004, this) || this.cardInfo_3004.CATEGORY;
            // 获取账户类型下拉列表
            this.getAccountTypeData({ dictValue: 'CATE' }, 'ACCOUNTTYPELIST');

        },
        // 获取账户类型列表
        getAccountTypeData(params, target) {
            this.$post.common.getBaseDataList(params).then((res) => {
                this[target] = res.data.content;
            });
        },
        // 争议账款工单
        Choice() {
            if (isEmptyObject(this.isChecked)) {
                this.$alert('请选择交易流水！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
            }
        },
        //根据菜单id查询话术列表
        async getspeechList() {
            console.log("this.isCurrentMenuInfo.id", this.isCurrentMenuInfo.id);
            console.log("this.MenuId", this.MenuId);
            var checkParam = {
                'id': this.MenuId || this.isCurrentMenuInfo.id,
            };
            this.$post.busiMenu.getlistByMenuId(checkParam).then((res) => {
                console.log("话术查询结果：", res);
                if (res.status === 200) { // http通讯成功
                    if (res.data.status == 0) { // 业务请求成功
                        this.speechList = res.data.content;
                    }
                }
            });
        },
        handleSelectionChange(val) {
            this.selectedList = val;
        },
        // 授权详细记录
        ChoiceAuth() {
            if (isEmptyObject(this.isChecked)) {
                this.$alert('请选择交易流水！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
                return;
            }
            this.$router.push('/businessSystem/cardAuthorizationTransaction');
        },
        // 发送短信
        sendMsg() {
            if (isEmptyObject(this.isChecked)) {
                this.$alert('请选择交易流水！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
                return;
            }
            //尊敬的客户：您的未出账单为记账日：XXXXXXXX，人民币交易金额：XX.XX元，美元交易金额：XX.XX美元，交易描述：XXX，卡号末四位：XXXX。

            const AMOUNT = this.isChecked.CURRNUM === '156' ? `${this.isChecked.AMOUNT}` : '0.0';
            const UAMOUNT = this.isChecked.CURRNUM === '840' ? `${this.isChecked.AMOUNT}` : '0.0';
            const PURDATESTR = this.isChecked.PURDATE.toString();
            const PURDATE = `${PURDATESTR.substr(0, 4)}-${PURDATESTR.substr(4, 2)}-${PURDATESTR.substr(6, 2)}`;
            const tempContent = `尊敬的客户：您的未出账单为记账日：${PURDATE}，人民币交易金额：${AMOUNT}元，美元交易金额：${UAMOUNT}美元，交易描述：${this.isChecked.DESLINE1.trim()}${this.isChecked.DESLINE2.trim()}，卡号末四位：${this.isChecked.CARDEND.toString().padStart(4, '0')}。`;
            this.$router.push({
                name: 'dynamicMessage',
                path: '/index/dynamicMessage',
                params: {
                    tempName: '100002-未出账单',
                    tempContent,
                },
            });
        },
        // 灵活分期申请
        mpabletrans() {
            this.MenuId = getBusinessMenuId('/instalment/ConsumeInstallment', this.businessMenu);
            console.log('this.MenuId____', this.MenuId);
            this.$router.push({ name: 'ConsumeInstallment', path: '/instalment/ConsumeInstallment', params: { id: this.MenuId } });
        },


        //尾页
        handleLastPage() {
            this.tableData = this.detailDataAll;
            this.pagingDataList = this.pageList;
            this.PG = '第' + this.totPgCnt + '页/共' + this.totPgCnt + '页';
            this.nextButtonFlag = true;
            this.lastButtonFlag = true;
            this.currentPageIndex = this.totPgCnt - 1;
            console.log("this.currentPageIndex", this.currentPageIndex);
            console.log("this.pagingDataList", this.pagingDataList);
        },

        // 上下页切换
        async handleChangePage(type) {
            this.isLoadingss = true;
            this.isChecked = {};
            if (type === 'pre') { // 切换到上一页
                if (this.currentPageIndex - 2 < 0) {
                    this.currentPageIndex = this.currentPageIndex - 2;
                    console.log("pagingDataList:", this.pagingDataList);
                    console.log("当前页索引:", this.currentPageIndex);
                    //this.pagingDataList = []; // 清空缓存 申请编号 -> 相当于首次查询
                    this.RtnindFlag = '0';
                    this.VALDATE = '';
                    this.PURDATE = '';
                    this.PURTIME = '';
                    this.TRANNO = '';
                } else {
                    this.RtnindFlag = '1';
                    console.log("pagingDataList:", this.pagingDataList);
                    console.log("当前页索引:", this.currentPageIndex);
                    this.currentPageIndex = this.currentPageIndex - 2;
                    this.VALDATE = this.pagingDataList[this.currentPageIndex].VALDATE;
                    this.PURDATE = this.pagingDataList[this.currentPageIndex].PURDATE;
                    this.PURTIME = this.pagingDataList[this.currentPageIndex].PURTIME;
                    this.TRANNO = this.pagingDataList[this.currentPageIndex].TRANNO;
                }
                await this.get_3011();
                this.isLoadingss = false;
            } else { // 切换到下一页
                this.RtnindFlag = '1';
                console.log("pagingDataList:", this.pagingDataList);
                console.log("当前页索引:", this.currentPageIndex);
                this.VALDATE = this.pagingDataList[this.currentPageIndex].VALDATE;
                this.PURDATE = this.pagingDataList[this.currentPageIndex].PURDATE;
                this.PURTIME = this.pagingDataList[this.currentPageIndex].PURTIME;
                this.TRANNO = this.pagingDataList[this.currentPageIndex].TRANNO;

                await this.get_3011();
                this.isLoadingss = false;
            }
        },

        async getAccountSum() {
            this.totalSumMap.totalPurchases = 0;//消费总额
            this.totalSumMap.totalPayBack = 0;//已结算付款额
            this.totalSumMap.totalEnchashment = 0;//取现总额
            this.totalSumMap.totalCommission = 0;//取现手续费总额

            this.totalSumMap.totalINTCHG = 0;//应收利息
            // 设置请求参数 -- 3001 交易
            const appBody = {
                CARDNO: this.searchForm.cardno, // 卡号
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志 0-不检查
            };
            const params = JSON.parse(JSON.stringify(this.defaultParams));
            params.body.appHead.tranCode = '3001';
            params.body.appBody = appBody;
            // 跑 3001 交易
            await this.$post.common.transPort(params).then((res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        //this.categoryMap = result.body.appBody;
                        this.totalSumMap.totalPurchases = parseFloat(parseFloat(this.totalSumMap.totalPurchases) + parseFloat(result.body.appBody.PURCHASES)).toFixed(2);//消费总额
                        this.totalSumMap.totalPayBack = parseFloat(parseFloat(this.totalSumMap.totalPayBack) + parseFloat(result.body.appBody.PYMTCLUD)).toFixed(2);//已结算付款额
                        this.totalSumMap.totalEnchashment = parseFloat(parseFloat(this.totalSumMap.totalEnchashment) + parseFloat(result.body.appBody.CASHADV)).toFixed(2);//取现总额
                        this.totalSumMap.totalCommission = parseFloat(parseFloat(this.totalSumMap.totalCommission) + parseFloat(result.body.appBody.ADVFEE)).toFixed(2);//取现手续费总额
                        console.log("3001返回取现总费用：" + this.totalSumMap.totalCommission);
                        this.totalSumMap.totalINTCHG = parseFloat(parseFloat(this.totalSumMap.totalINTCHG) + parseFloat(result.body.appBody.INTCHG)).toFixed(2);//应收利息

                    } else {
                        //this.$message.error(result.sysHead.rspMsg);
                    }
                } else {
                    //this.$message.error('请求失败');
                }
            });
        },


        async getData() {
            this.isChecked = {};
            this.pagingDataList = [];
            this.resultlist = [];
            this.PURDATE = '';
            this.VALDATE = '';
            this.PURTIME = '';
            this.TRANNO = '';
            this.totalSumMap.totalfee = 0;
            this.totalSumMap.totalCommission = 0;
            this.totalSumMap.totalreturn = 0;
            this.totalSumMap.totalmppayfee = 0;
            this.totalSumMap.resendstfee = 0;
            this.totalSumMap.changecardfee = 0;
            await this.get_3011();

            await this.queryall();

            console.log("this.resultlist", this.resultlist);

            for (let i = 0; i < this.resultlist.length; i++) {
                let item = this.resultlist[i];
                if (item.DESLINE1.indexOf('退货') !== -1) {
                    this.totalSumMap.totalreturn = parseFloat(this.totalSumMap.totalreturn) + parseFloat(item.AMOUNT);
                }

                // if (item.DESLINE1.indexOf('提前还款手续费') !== -1) {
                //     this.totalSumMap.totalmppayfee = parseFloat(this.totalSumMap.totalmppayfee) + parseFloat(item.AMOUNT);
                // }
                // if (item.DESLINE1.indexOf('帐单复制费') !== -1) {
                //     this.totalSumMap.resendstfee = parseFloat(this.totalSumMap.resendstfee) + parseFloat(item.AMOUNT);
                // }
                // if (item.DESLINE1.indexOf('补换卡费') !== -1) {
                //     this.totalSumMap.changecardfee = parseFloat(this.totalSumMap.changecardfee) + parseFloat(item.AMOUNT);
                // }
            }
            this.totalSumMap.totalreturn = parseFloat(this.totalSumMap.totalreturn).toFixed(2);
            //this.totalSumMap.totalfee = parseFloat(parseFloat(this.totalSumMap.totalCommission) + parseFloat(this.totalSumMap.totalmppayfee) + parseFloat(this.totalSumMap.resendstfee) + parseFloat(this.totalSumMap.changecardfee)).toFixed(2);
            console.log("取现手续费：" + this.totalSumMap.totalCommission + "，提前还款手续费：" + this.totalSumMap.totalmppayfee + "，账单补寄费：" + this.totalSumMap.resendstfee + "，补换卡费：" + this.totalSumMap.changecardfee + "，总费：" + this.totalSumMap.totalfee);
        },

        //查询所有明细
        async queryall() {

            console.log("ym");
            const appBody = {

                CARDNBR: this.searchForm.cardno || '', // 卡号
                TRANYM: this.TRANYM,
                OPTION: 'A',
                PINFLAG: this.defaultpinFlag,
                RTNIND: this.RtnindFlagAll, // 翻页标志 首次传空， 翻页传1
                ENQFLAG: 0, // 0：返回账户交易明细，默认方式；1：按查询卡号返回交易明细
                VALDATE: this.VALDATE,
                PURDATE: this.PURDATE,
                PURTIME: this.PURTIME,
                TRANNO: this.TRANNO,
            };
            console.log("appBody", appBody);
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3011';
            defaultParams.body.appBody = appBody;
            // 3077交易

            await this.$post.common.transPort(defaultParams).then(async (res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        this.resultlist.push(...result.body.appBody.dataList);
                        console.log("result.body.appBody.RTNIND", result.body.appBody.RTNIND);
                        // 修改翻页标志 
                        this.RtnindFlagAll = result.body.appBody.RTNIND;
                        this.detailDataAll = result.body.appBody.dataList;

                        this.VALDATE = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].VALDATE;
                        this.PURDATE = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].PURDATE;
                        this.PURTIME = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].PURTIME;
                        this.TRANNO = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].TRANNO;

                        const currentPagingData = {
                            VALDATE: result.body.appBody.dataList[result.body.appBody.dataList.length - 1].VALDATE,
                            PURDATE: this.PURDATE,
                            PURTIME: result.body.appBody.dataList[result.body.appBody.dataList.length - 1].PURTIME,
                            TRANNO: result.body.appBody.dataList[result.body.appBody.dataList.length - 1].TRANNO,
                        };
                        this.pageList.push(currentPagingData);
                        if (result.body.appBody.RTNIND === '1') {

                            await this.queryall();
                        } else {
                            this.isLoading = false;
                            console.log('this.resultlist', this.resultlist);
                            this.totCnt = this.resultlist.length;
                            console.log("totCnt", this.totCnt);
                            console.log("detailDataAll", this.detailDataAll);

                            this.totPgCnt = Math.ceil(this.totCnt / 10);
                            this.currentPageIndex = 0;
                            this.pagingDataList = this.pageList;
                            this.PG = '第1页/共' + this.totPgCnt + '页';
                            console.log("this.pageList", this.pageList);
                            if (this.totPgCnt != 1) {
                                this.lastButtonFlag = false;
                                this.nextButtonFlag = false;
                            } else {
                                this.nextButtonFlag = true;
                                this.lastButtonFlag = true;
                            }
                        }
                    }
                }
            });
        },

        async get_3011() {
            this.defaultParams.sysHead.busiName = '未出账单明细查询';
            // 3011 配置请求头
            const appBody_3011 = {
                CARDNBR: this.searchForm.cardno || '', // '6250520500008751'卡号
                PINFLAG: '0', // 是否检查密码标志
                RTNIND: this.RtnindFlag, // 翻页标志 首次传空， 翻页传1
                PIN: '',
                OPTION: 'A', // 币种选项 L:第一币种 I:第二币种 A:所有币种
                VALDATE: this.VALDATE,
                PURDATE: this.PURDATE,
                PURTIME: this.PURTIME,
                TRANNO: this.TRANNO,
                ENQFLAG: 0,
                ORDERFLAG: 0,
            };
            let bool = false;
            if (this.pagingDataList.length == 0) bool = true;
            const result_3011 = await get_3xxx(
                '3011',
                '未出账单明细查询',
                appBody_3011,
                this,
                true,
                bool,
            );
            // if (!result_3121) return false;
            // 如果传过来的为空, 则无下翻页 ,将下翻按钮禁用
            if (!result_3011) {
                if (this.pagingDataList.length != 0) {
                    this.$message.warning('已经到最后一条数据');
                }
                this.nextButtonFlag = true;
                this.tableData = [];
                return false;
            }
            for (const i in result_3011.body.appBody.dataList) {
                result_3011.body.appBody.dataList[i].id = Math.ceil(Math.random() * 100);
            }
            this.RtnindFlag = result_3011.body.appBody.RTNIND;
            this.tableData = result_3011.body.appBody.dataList;

            // console.log(this.tableData);
            this.currentPageIndex = this.currentPageIndex + 1;

            console.log("this.currentPageIndex1:", this.currentPageIndex);
            let curInd = this.currentPageIndex + 1;
            console.log("curInd", curInd);
            this.PG = '第' + curInd + '页/共' + this.totPgCnt + '页';

            if (curInd === this.totPgCnt) {
                this.nextButtonFlag = true;
                this.lastButtonFlag = true;
            } else {
                this.nextButtonFlag = false;
                this.lastButtonFlag = false;
            }
            // 翻页设置
            //ChangePage(this, ['PURDATE', 'VALDATE', 'PURTIME', 'TRANNO'], 'tableData', 10);
        },
    },
    components: {
        cardComponent,
    },
};
</script>

<style lang='scss'>
.UnBillChecked {
    .el-card .el-card__body,
    .el-card__header {
        padding: 10px;
    }
    .el-form--inline .el-form-item {
        margin-right: 5px;
    }
    .itme-header-left {
        font-size: 18px;
        margin-bottom: 20px;
        text-align: center;
    }
    .itme-header {
        font-weight: 400;
        color: #1f2f3d;
        text-align: left;
        margin-left: 15px;
    }
    .text {
        font-size: 14px;
    }
    .item {
        margin-bottom: 12px;
        color: #111;
        margin: 0 0 15px 15px;
    }
    .itme-text {
        display: inline-block;
        text-align: right;
        width: 50%;
        color: #666;
        margin-right: 15px;
    }
    .clearfix {
        line-height: 30px;
        text-align: left;
        &:before,
        &:after {
            display: table;
            content: "";
        }
        &:after {
            clear: both;
        }
    }
    .box-card {
        width: 100%;
        .el-row .el-col {
            margin-top: -3px;
        }
    }
    .btn_box {
        text-align: center;
    }
}
</style>
